'''
Created on Apr 2, 2012

@author: wilshusensk
'''
import os
from java.lang import System, Class, ClassNotFoundException
from java.sql import DriverManager, SQLException
import sys
import random
import unittest
from ConstellationWebFinder import *
from SQLCommands import *
from tableNameEnumWannabe import TableNames

class TestSequenceFunctions(unittest.TestCase):
    '''
    def setUp(self):
        self.seq = range(10)
    
    def test_choice(self):
        element = random.choice(self.seq)
        self.assertTrue(element in self.seq)

    def test_sample(self):
        for element in random.sample(self.seq, 5):
            self.assertTrue(element in self.seq)
    '''
    def test_getConstellationsForConway(self):
        listOfConstellations = findConstellationsWithZipCode(72032)
        self.assertTrue(len(listOfConstellations) > 0)
        
    def test_getExoplanetsForConway(self):
        listOfConstellations = findConstellationsWithZipCode(72032)
        self.assertTrue(len(listOfConstellations) > 0)
        
    def test_getConstellationsForConway(self):
        listOfConstellations = findConstellationsWithZipCode(72032)
        self.assertTrue(len(listOfConstellations) > 0)
def createConnection():
        try:
            System.setProperty("sqlite.purejava", "true")
            Class.forName("org.sqlite.JDBC")
            con = DriverManager.getConnection("jdbc:sqlite:constellationInfo")
            global stat
            stat = con.createStatement()
        except ClassNotFoundException, e:
            sys.exit(e.message)
        except SQLException, e:
            sys.exit(e.message)
            
if __name__ == '__main__':
    createConnection()
    unittest.main()
